/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 阿宾
 * Date: 2024-09-30
 * Time: 09:58
 */
class B {
    public B() {
        func(); // 会调用子类的func
    }

    public void func() {
        System.out.println("B.func()");
    }
}

class D extends B {
    public int num = 1;

    public D() {
        super();
    }
    @Override
    public void func() {
        //0
        System.out.println("D.func() " + num);
    }
}
public class Test2 {
    public static void main(String[] args) {
        D d = new D();
    }
}
